// JavaScript Document

  function M_L_Move(id,pn,m){  //显示列表左右滚动
    var obj = $('#'+id);
    var p   = parseInt(obj.attr('pn')|0);
    if(typeof(m)=='number'){
      pn = p + m;
    }
    if( pn == p || pn < 0 || pn > 1 )return;

    var px = parseInt(obj.attr('px')) * pn * -1;

    if(id=='M_L_0_UL'){
      if(divF.attr('isin')==1)return;
      divF.attr('isin',1);
      obj.animate({ marginLeft:px},'fast',function(){
        divF.attr('isin',0);b_imgchange(pn*3);
      });
    } else {
      obj.animate({ marginLeft:px},'slow');
    }
    var objc = '#'+ id +'_C';
    objc = $('.M_L',objc);
    var tmp = $(objc[pn]).attr('src');
    $(objc[pn]).attr('src',$(objc[p]).attr('src'));
    $(objc[p]).attr('src',tmp);
    obj.attr('pn',pn);
  }

  var imgS,divF;
  function b_imgchange(id){ // 焦点图切换
    if(typeof(divF)=='undefined'){
      divF=$('div:first','#play_swf');
      divF.hover(
        function(){divF.attr('isin',1);$(".biao","#M_L_0_BIMG_"+(parseInt(divF.attr('pn')|0))).show()},
        function(){divF.attr('isin',0);$(".biao","#M_L_0_BIMG_"+(parseInt(divF.attr('pn')|0))).hide()}
      );
    }
    if(divF.css('display') == 'none' || divF.attr('isin') == 1 || $('#LPSS').length>0)return;
    if(typeof(id)!="number"){
      id = (parseInt(divF.attr('pn')|0)+1)%3 + parseInt($('#M_L_0_UL').attr('pn')|0)*3;
    }

    if(typeof(imgS)=='undefined'){
      imgS = $(".img[name='chborder1']","#M_L_0_UL");
    }
    if(id >= imgS.length)id=0;
    var img_id = 'M_L_0_BIMG_'+id;
    if($('#'+img_id).length < 1){
      imgA       = imgS.eq(id);
      imgA       = $('a:first',imgA);
      var src    = imgA.attr('b_pic');
      var con    = imgA.attr('content');
      var href   = imgA.attr('href');
      var target = imgA.attr('target');
      var title  = imgA.attr('title');

      var link   = 'href="'+ href +'" target="'+ target +'"';

      var htm    = $('<div id="' + img_id + '">\
                    <div class="biao" style="display:none" onclick="window.open(\''+ href +'\',\''+ target +'\')"></div>\
                    <a '+ link +'><img src="'+ src +'" width="422" height="311"/></a>\
                    <div class="mm"></div>\
                    <dl>\
            	        <dt><span><a '+ link +' class="c_white">'+ title +'</span></a></dt>\
            		      <dd>'+ con +'</dd>\
            	      </dl>\
                    </div>');
    }

    divF.children().each(function(){
      var _ = $(this);
      if(_.attr('id')== img_id){
        _.show();
      } else {
        _.hide();
      }
    });

    divF.attr('pn',id).append(htm);
    M_L_0_UL_select(id);
    //M_L_Move('M_L_0_UL',Math.floor(id/3));
  }

  function M_L_0_UL_select(id){
    var i=0;
    $("li","#M_L_0_UL").each(function (){
      if(id==i++){
        this.className="expli";
      } else {
        this.className="";
      }
    });
  }